function! leaderf#tabs#source(args) abort
    if exists('*execute')
        let tab_lst = split(execute('tabs'), '\n')
    else
        redir => reg
        silent tabs
        redir END
        let tab_lst = split(reg, '\n')
    endif
    let line = ''
    let index = 0
    let lines = []
    for tab in tab_lst
        if tab =~# '^Tab'
            if line != ''
                call add(lines, line)
            endif
            let index += 1
            let line = index . "\t"
        else
            let line = line . ' ' . tab
        endif
    endfor
    call add(lines, line)
    return lines
endfunction

function! leaderf#tabs#select(line) abort
    let num = split(a:line, "\t")[0]
    call feedkeys(num . 'gt')
endfunction
